install_sh = @install_sh@
mkdir_p = @mkdir_p@
INSTALL = @INSTALL@
VIEWERDIR = @prefix@/viewer
CP = /bin/cp
INSTALL_BUNDLE ?= "bundle:min"


all: arkimeparser.js

arkimeparser.js: arkimeparser.jison
	jison arkimeparser.jison

check:
	cnpm ci
	cnpm run bundle

install:
	@mkdir -p "$(VIEWERDIR)" "$(VIEWERDIR)/vueapp"
	/bin/rm -f $(VIEWERDIR)/public/style.css
	$(INSTALL) *.js package.json package-lock.json $(VIEWERDIR)
	cnpm ci
	cnpm run $(INSTALL_BUNDLE)
	(cd public ; wget -N https://gitee.com/jimonik/packet_rep/releases/download/CyberChef/CyberChef_v10.6.0.zip)
	$(CP) -pr views public $(VIEWERDIR)
	$(CP) -pr vueapp/dist "$(VIEWERDIR)/vueapp"
	(cd $(VIEWERDIR) ; cnpm ci --production)

distclean realclean clean:
	rm -rf node_modules
	rm -rf bundle
	(cd vueapp ; rm -rf node_modules ; rm -rf dist)
